let mongoose = require("mongoose");

let loginSchema = require("./login");
let registerSchema = require("./register");

/**
 * 连接数据库
 */
mongoose.connect("mongodb://localhost:27017/ais");
const db = mongoose.connection;
db.on("error", console.error.bind(console, "MongoDB连接失败:"));
db.once("open", () => {
	console.log("MongoDB连接成功！");
});

/**
 * 开启校验
 */
const Login = mongoose.model("login", loginSchema);
const Register = mongoose.model("register", registerSchema);

exports.Login = Login;
exports.Register = Register;
